var app = getApp();
Page({
  data: {
    winWidth: 0,
    winHeight: 0,
    currentTab: 0, // tab切换 
    isHiddenMes1: true,
    isHiddenMes2: true,
    isHiddenMes3: true,
    isHiddenMes4: true,

    list: [{
      id: 2,
      enterprise_logo: '../../images/big_avatar.png',
      p_name: '清源山风景区游览门票 全天游览，不限时',
      p_wages: '444.00',
      enterprise_name: '景区门票',
      p_address: '2018-06-01 15:20:32',//下单时间
      p_edujy: '1',
      p_education: '444.00',
      p_num: 'x1',
      titlename: '清源山风景区',
      status:0,
      end_data:'2018-06-13',
      orderType:'all'
    },{
        id: 3,
        enterprise_logo: '../../images/big_avatar.png',
        p_name: '3-4人 尊享火锅套餐 送酒水饮料',
        p_wages: '240.00',
        enterprise_name: '美食团购',
        p_address: '2018-06-11 15:20:32',
        p_edujy: '1',
        p_education: '24.00',
        p_addtime: 'x1',
        titlename: '丰泽火锅店',
        status: 1,
        end_data: '2018-06-13',
        orderType: 'all'
    }],
    weiRun:[],//未进行
    daiPay:[],//待支付
    tuikuang_list:[
      {
        id:2,
        enterprise_logo:'../../images/big_avatar.png',
        p_name:'清源山风景区游览门票 全天游览，不限时',
        p_wages:'444.00',
        enterprise_name:'景区门票',
        p_address:'2018-06-01 15:20:32',
        p_edujy:'1',
        p_education:'444.00',
        p_addtime:'x1',
        titlename:'清源山风景区',
        orderType: 'tuikuang'
      }
    ]
  },
  // 一个页面只会调用一次。
  onLoad: function (options) {
    var that = this;
    // app.loading();
    //获取设备宽高
    that.setData({
      winWidth: app.globalData.systemInfo.windowWidth,
      winHeight: app.globalData.systemInfo.windowHeight
    });

    if (this.data.tuikuang_list.length>0){
      that.setData({
        isHiddenMes4:false
      })
    }
    if (this.data.list.length > 0) {
      that.setData({
        isHiddenMes1: false
      })
    }

  },
  // 每次打开页面都会调用一次。
  onShow: function () {

  },
  // 一个页面只会调用一次
  onReady: function () {

  },
  //当navigateTo或底部tab切换时调用。
  onHide: function () {

  },
  //当redirectTo或navigateBack的时候调用。
  onUnload: function () {

  },
  //点击tab切换
  swichNav: function (e) {
    var that = this;
    if (this.data.currentTab === e.target.dataset.current) {
      return false;
    } else {
      this.setData({
        currentTab: e.target.dataset.current
      })
    }
  },
  //滑动切换tab
  bindChangeTab: function (e) {

    this.setData({ currentTab: e.detail.current });

  },

  orderDetail:function(e){
    console.log('查看详情', e.currentTarget.dataset.index, e.currentTarget.dataset.id);
  },
  deleteOrder:function(e){
    console.log('删除订单--通过type找到对应的数组', e.currentTarget.dataset.type, e.currentTarget.dataset.index);

  },
  buyAgain:function(e){
    console.log('再次购买--通过索引值获取对应数组的对象', e.currentTarget.dataset.index);

  }

})

// https://blog.csdn.net/shaleilei/article/details/78345508 模板传值
// https://blog.csdn.net/github_39371177/article/details/80251211 多级菜单